// ml:run = $bin < input
#include <iostream>

using ll = long long;

ll gcd(ll x, ll y)
{
    return !y ? x : gcd(y, x % y);
}

ll lcm(ll x, ll y)
{
    return x * y / gcd(x, y);
}

int main()
{
    std::ios::sync_with_stdio(false);
    ll n; std::cin >> n;
    if (n == 1) {
        std::cout << 1 << "\n";
        return 0;
    }
    ll tmp = n * (n - 1);
    ll ans = tmp;
    for (int i = n - 2; i >= 1; i--) ans = std::max(ans, lcm(tmp, i));
    if (n > 2) {
        tmp = (n - 2) * (n - 1);
        for (int i = n - 3; i >= 1; i--) ans = std::max(ans, lcm(tmp, i));
    }
    std::cout << ans << "\n";
}

